home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Graphics 2D / Out of This GWorld / out.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  3.5 KB  |  133 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        out.h
  3.  
  4.     Contains:    This application demonstrates one method to                    
  5.                 produce animation on the Macintosh using QuickDraw's        
  6.                 palette manager animation routines.  The app simply            
  7.                 creates an offscreen image, copies it to the                
  8.                 screen's window, then calls AnimatePalette()                
  9.                 every cycle through the eventloop.  To provide the            
  10.                 fastest possible animation, the image is only                
  11.                 created and copied once from the offscreen GWorld.            
  12.                 The actual animation is produced by shifting the            
  13.                 color entries within its colortable forward or                
  14.                 backward one index.  Also the cTable is divided                
  15.                 and shifted in two separate groups to simulate                
  16.                 objects moving at different speeds.            
  17.  
  18.     Written by: EL
  19.  
  20.     Copyright:    Copyright © 1991-1999 by Apple Computer, Inc., All Rights Reserved.
  21.  
  22.                 You may incorporate this Apple sample source code into your program(s) without
  23.                 restriction. This Apple sample source code has been provided "AS IS" and the
  24.                 responsibility for its operation is yours. You are not permitted to redistribute
  25.                 this Apple sample source code as "Apple sample source code" after having made
  26.                 changes. If you're going to re-distribute the source, we require that you make
  27.                 it clear in the source that the code was descended from Apple sample source
  28.                 code, but that you've made changes.
  29.  
  30.     Change History (most recent first):
  31.                 08/2000        JM                Carbonized, non-Carbon code is commented out
  32.                                             for demonstration purposes.
  33.                 7/16/1999    KG                Updated for Metrowerks Codewarror Pro 2.1
  34.                 
  35.  
  36. */
  37. #include "CarbonPrefix.h"
  38. #include <AppleEvents.h>
  39. #include <Types.h>
  40. #include <Resources.h>
  41. #include <QuickDraw.h>
  42. #include <Fonts.h>
  43. #include <Events.h>
  44. #include <Windows.h>
  45. #include <Menus.h>
  46. #include <TextEdit.h>
  47. #include <Dialogs.h>
  48. //#include <Desk.h>
  49. #include <Devices.h>
  50. #include <ToolUtils.h>
  51. #include <Memory.h>
  52. #include <SegLoad.h>
  53. #include <Files.h>
  54. #include <OSUtils.h>
  55. //#include <OSEvents.h>
  56. #include <Events.h>
  57. #include <DiskInit.h>
  58. #include <Packages.h>
  59. #include <Traps.h>
  60. #include <QDOffscreen.h>
  61. #include <Palettes.h>
  62.  
  63. /* Constant Declarations */
  64.  
  65. #define    WWIDTH        360
  66. #define    WHEIGHT        360
  67.  
  68. //#define WLEFT        (((qd.screenBits.bounds.right - qd.screenBits.bounds.left) - WWIDTH) / 2)
  69. //#define WTOP        (((qd.screenBits.bounds.bottom - qd.screenBits.bounds.top) - WHEIGHT) / 2)
  70.  
  71. #define    TOTALCOLORS    255
  72. #define    SUN2MAC        (65535. / 255.)
  73. #define    SCALE        3
  74.  
  75. #define    STOP        0
  76. #define    START        1
  77. #define    FORWARD        0
  78. #define REVERSE        1
  79. #define    COLOR        0
  80. #define    GRAY        1
  81.  
  82. extern    WindowPtr        gWindow;
  83. extern    CTabHandle        gCTable;
  84. extern    GWorldPtr        gGWorld;
  85. extern    PixMapHandle    gPixMap;
  86. extern    PaletteHandle    gPalette;
  87.  
  88. extern    int                gCurrentPat;
  89. extern    int                gCurrentMove;
  90. extern    int                gCurrentDir;
  91. extern    int                gCurrentColor;
  92.  
  93. void initMac();
  94. void initVariables();
  95. void createWindow();
  96. void createGWorld();
  97. void createPalette();
  98. void updatePalette();
  99. void defineColorPalette();
  100. void defineGrayPalette();
  101. void createImage();
  102. void drawWindowBorder();
  103. void drawImage();
  104. void pollEvents();
  105. void cleanUp();
  106. void doAbout();
  107. void setRGB();
  108. void setColor();
  109.  
  110. void createColorScale();
  111. void createColorWheels();
  112. void createColorRings();
  113. void createColorGears();
  114. void createColorCurves();
  115. void createColorBalls();
  116. void createColorWave();
  117. void createColorText();
  118.  
  119. void animateCTable();
  120.  
  121. void testTriangle();
  122. void shadeWasher();
  123. void translate();
  124. void scale();
  125. void drawCircle();
  126. void drawWasher();
  127. void drawLine();
  128.  
  129. void setUpMenus();
  130. void adjustMenus();
  131. void enable();
  132. void handleMenu();
  133.